﻿// JavaScript Document
//var boolall=false;

function accountcheck(){
	var account=document.getElementById("account").value;
	if(/^[\w]{3,12}$/.test(account)){//boolall=true;
		document.getElementById("s_account").innerHTML="<font color='#00ff'>√</font>"
			return true;
		}else{//boolall=false;
		document.getElementById("s_account").innerHTML="<font color='#ff00'>只可包含a-z 0-9和下划线</font>"
		return false;
		}
	}
function passwordcheck(){
	var password=document.getElementById("password").value;
	if(/^.{6,}$/.test(password)){
		document.getElementById("s_password").innerHTML="<font color='#00ff'>√</font>"
			return true;
		}else{
		document.getElementById("s_password").innerHTML="<font color='#ff00'>至少包含6个字符</font>"
		return false;}
	}
function password_fcheck(){
	var password_f=document.getElementById("password_f").value;
	var password=document.getElementById("password").value;
	if(password_f==passwrod){
		document.getElementById("s_password_f").innerHTML="<font color='#00ff'>√</font>"
	return true;	
	}else{
		document.getElementById("s_password_f").innerHTML="<font color='#ff00'>两次输入密码不相同</font>"
		return false;}
	}
function emailcheck(){
	var email=document.getElementById("email").value;
	if(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(email)){
		document.getElementById("s_email").innerHTML="<font color='#00ff'>√</font>"
			return true;
		}else{
		document.getElementById("s_email").innerHTML="<font color='#ff00'>必须包含@字符</font>"
		return false;}
	}
	
function sfzcheck(){
	var sfz=document.getElementById("sfz").value;
	if(sfz.length===15||sfz.length===18){
		document.getElementById("s_sfz").innerHTML="<font color='green'> 身份证合法 </font>"
			return true;}
		else {
		document.getElementById("s_sfz").innerHTML="<font color=red> 身份证不合法 </font>"
			return false;}
	}
	
function phonecheck(){
	var testma=/^[1][35789][0-9]{9}$/;
	var sj=document.getElementById("cellphone").value;
	if(testma.test(sj)){
		document.getElementById("s_phone").innerHTML="<font color='green'> 手机号合法 </font>"
			return true;}
		else {
		document.getElementById("s_phone").innerHTML="<font color=red> 手机号不合法 </font>"
			return false;}
	}
function namecheck(){
	var name=document.getElementById("name").value;
//	alert(name);
	if(name==""){
	document.getElementById("s_name").innerHTML="<font color=red> 姓名不能为空 </font>"
		return false;}
	else{return true;}
}
function addresscheck(){
	var address=document.getElementById("address").value;
	if(address==""){
	document.getElementById("s_address").innerHTML="<font color=red> 地址不能为空 </font>"
		return false;}
	else{return true;}
}
function contentcheck(){
	var contentch=document.getElementById("contentch").value;
	if(contentch==""){
	document.getElementById("s_check").innerHTML="<font color=red> 内容不能为空 </font>"
		return false;}
	else{return true;}
}
function checkall(){
	var bool=false;
//	var a=accountcheck();
//	var b=passwordcheck();
//	var c=password_fcheck();
	var d=namecheck();
	var e=addresscheck();
	if(d&&e){bool=true;}else{bool=false;}
	return bool;
	}

function checkcontent(){
	var bool=false;
	var d=contentcheck();
	if(d){bool=true;}else{bool=false;}
	return bool;
}
function checkregister(){
	var bool=false;
//	var a=accountcheck();
//	var b=passwordcheck();
//	var c=password_fcheck();
	var d=namecheck();
	if(d){bool=true;}else{bool=false;}
	return bool;
}